﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Dawn.Web.Extensions
{
    public static class MappingExtensions
    {
        public static TDestination MapTo<TSource, TDestination>(this TSource source)
        {
            return Mapper.Map<TSource, TDestination>(source);
        }

        public static TDestination MapTo<TSource, TDestination>(this TSource source, TDestination destination)
        {
            return Mapper.Map(source, destination);
        }

        #region 文章
        //public static ArticleModel ToModel(this Article entity)
        //{
        //    return entity.MapTo<Article, ArticleModel>();
        //}

        //public static Article ToEntity(this ArticleModel model)
        //{
        //    return model.MapTo<ArticleModel, Article>();
        //}

        //public static Article ToEntity(this ArticleModel model, Article destination)
        //{
        //    return model.MapTo(destination);
        //}
        #endregion
    }
}